<template>
  <f7-page>
    <f7-navbar title="吉林动画学院用人申请表" back-link=""></f7-navbar>

    <f7-list form>
      <f7-list-item>
        <f7-label>名称</f7-label>
        <f7-input type="text" :value="formContent.title"  :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item>
        <f7-label>创建时间</f7-label>
        <f7-input type="text" :value="formContent.creationDate" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item  >
        <f7-label>申请部门</f7-label>
        <f7-input type="text" :value="formContent.orgName" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item >
        <f7-label>申请事由</f7-label>
        <f7-input type="text" :value="resonNum[formContent.reason]" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item>
        <f7-label>职位名称</f7-label>
        <f7-input type="text" :value="formContent.positionName" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item  >
        <f7-label>拟招聘人数</f7-label>
        <f7-input  type="tel" :value="formContent.recruitCount" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item>
        <f7-label>定编人数</f7-label>
        <f7-input type="text" :value="formContent.allocationCount" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item>
        <f7-label>现有人数</f7-label>
        <f7-input type="text" :value="formContent.existCount" :disabled="true"></f7-input>
      </f7-list-item>

      <f7-list-item >
        <f7-label>核心职责</f7-label>
        <f7-input type="textarea"   :value="formContent.coreRecruit" :disabled="true" ></f7-input>
      </f7-list-item>
      <f7-list-item >
        <f7-label>常规职责</f7-label>
        <f7-input type="textarea"   :value="formContent.commonRecruit" :disabled="true" ></f7-input>
      </f7-list-item>
      <f7-list-item >
        <f7-label>任职基本条件</f7-label>
        <f7-input type="textarea"   :value="formContent.baseCondition" :disabled="true" ></f7-input>
      </f7-list-item>

      <f7-list-item>
        <f7-label>待遇标准</f7-label>
        <f7-input type="text" :value="formContent.treatmentLevel" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item>
        <f7-label>建议招聘方式</f7-label>
        <f7-input type="text" :value="recruitChannelNum[formContent.recruitType]" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item>
        <f7-label>申请人</f7-label>
        <f7-input type="text" :value="formContent.createBy" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item>
        <f7-label>部门负责人</f7-label>
        <f7-input type="text" :value="formContent.depUser" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item>
        <f7-label>人力资源处长</f7-label>
        <f7-input type="text" :value="formContent.manpower" :disabled="true"></f7-input>
      </f7-list-item>
    </f7-list>
  </f7-page>
</template>

<script>
    export default {
      name: "recruitApplyView",
      data() {
        return {
          userId: sessionStorage.getItem('userId'),
          resonNum: this.GLOBAL.resonNum,
          orgNames: [],
          recruitChannelNum: this.GLOBAL.recruitChannelNum,
          pastMemory: {},
          formContent: {
            title: "吉林动画学院用人申请表",
            createBy: sessionStorage.getItem('userName'),
            creationDate:"",
            baseCondition:"",
            allocationCount:0,
            commonRecruit:"",
            coreRecruit:"",
            existCount:0,
            manpower:"",
            orgName: "动画工程中心",
            orgId: 20769,
            positionName:"",
            reason:0,
            recruitCount: 0,
            recruitType:0,
            treatmentLevel: "",
            auditResult: "流程尚未启动",
            depUser:"",
          }
        }
      },
      mounted() {
        this.$f7ready((f7) => {
          let that = this;
          f7.request.setup({
            headers: {
              'AccessToken': sessionStorage.getItem('accessToken'),
              'JSESSIONID': sessionStorage.getItem('userToken'),
            }
          });
          //console.log( "id:" + that.$f7route.params.id )
          f7.request.json(that.GLOBAL.RequestAddress + '/camel/rest/users/' + that.userId + "/orgs",{
              'page':1,
              'start':0,
              'limit':20
            }, function(res){
              if(res.totalCount>0){
                that.orgNames = res.data;
              }
            }
          );
          f7.request.json(that.GLOBAL.RequestAddress + '/camel/rest/recruitapplys', {
            'page': 1,
            'limit': 10,
            'jsonStr': '',
            'otherStr': '',
            'start': '0'
          }, function (result) {
            if (result.totalCount > 0) {
              for (let pm of result.data) {
                if (pm.id == that.$f7route.params.id) {
                  that.pastMemory = pm;
                  break;
                }
              }
              if (Object.keys(that.pastMemory).length === 0) {
                return;
              } else {
                that.formContent.title = that.pastMemory.title;
                that.formContent.createBy = that.pastMemory.createBy;
                that.formContent.baseCondition = that.pastMemory.baseCondition;
                that.formContent.allocationCount = that.pastMemory.allocationCount;
                that.formContent.commonRecruit = that.pastMemory.commonRecruit;
                that.formContent.coreRecruit = that.pastMemory.coreRecruit;
                that.formContent.existCount = that.pastMemory.existCount;
                that.formContent.manpower = that.pastMemory.manpower;
                that.formContent.orgName = that.pastMemory.orgName;
                that.formContent.orgId = that.pastMemory.orgId;
                that.formContent.positionName = that.pastMemory.positionName;
                that.formContent.reason = that.pastMemory.reason;
                that.formContent.recruitCount = that.pastMemory.recruitCount;
                that.formContent.recruitType = that.pastMemory.recruitType;
                that.formContent.treatmentLevel = that.pastMemory.treatmentLevel;
                that.formContent.auditResult = that.pastMemory.auditResult;
                that.formContent.depUser = that.pastMemory.depUser;
                that.formContent.creationDate = that.pastMemory.creationDate;
              }
              ;
            }
          })
        });
      },
    }
</script>

<style scoped>

</style>
